package com.huchao.www.utils;

import com.apifan.common.random.source.AreaSource;
import com.apifan.common.random.source.DateTimeSource;
import com.apifan.common.random.source.NumberSource;
import com.apifan.common.random.source.PersonInfoSource;
import com.huchao.www.pojo.StudentInfo;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @Description:
 * @BelongsProject: background-management-v10
 * @BelongsPackage: com.huchao.www.utils
 * @Author: 亖思
 * @CreateTime: 2023/3/10 21:34
 * @Version: 1.0
 */
public class FakerDataUtil {
      String prv = AreaSource.getInstance().randomProvince();
      LocalDate beginDate = LocalDate.of(2001,1,1);
      LocalDate endDate = LocalDate.of(2003,12,31);
      String idCard = PersonInfoSource.getInstance().randomFemaleIdCard(prv, beginDate, endDate);
      String name = PersonInfoSource.getInstance().randomChineseName();
      int randomState = NumberSource.getInstance().randomInt(0, 2);
      int randomCollege = NumberSource.getInstance().randomInt(1, 14);
      int randomMajor = NumberSource.getInstance().randomInt(1, 25);
      int randomClass = NumberSource.getInstance().randomInt(1, 46);
      LocalDateTime time = DateTimeSource.getInstance().randomPastTime(365*3);

    public StudentInfo getFakerData(){
        StudentInfo studentInfo = new StudentInfo();
        studentInfo.setStuName(name);
        studentInfo.setStuIdCard(idCard);
        if(randomState == 0){
            studentInfo.setStuState(true);
        }else {
            studentInfo.setStuState(false);
        }
        studentInfo.setClassNum(randomClass);
        studentInfo.setCollege(randomCollege);
        studentInfo.setMajor(randomMajor);
        studentInfo.setStuRepoTime(time);
        return studentInfo;
    }
}
